# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.DataMigration.V1.Model.DatabaseEntity do
  @moduledoc """
  The base entity type for all the database related entities. The message contains the entity name, the name of its parent, the entity type, and the specific details per entity type.

  ## Attributes

  *   `database` (*type:* `GoogleApi.DataMigration.V1.Model.DatabaseInstanceEntity.t`, *default:* `nil`) - Database.
  *   `databaseFunction` (*type:* `GoogleApi.DataMigration.V1.Model.FunctionEntity.t`, *default:* `nil`) - Function.
  *   `databasePackage` (*type:* `GoogleApi.DataMigration.V1.Model.PackageEntity.t`, *default:* `nil`) - Package.
  *   `entityDdl` (*type:* `list(GoogleApi.DataMigration.V1.Model.EntityDdl.t)`, *default:* `nil`) - Details about the entity DDL script. Multiple DDL scripts are provided for child entities such as a table entity will have one DDL for the table with additional DDLs for each index, constraint and such.
  *   `entityType` (*type:* `String.t`, *default:* `nil`) - The type of the database entity (table, view, index, ...).
  *   `issues` (*type:* `list(GoogleApi.DataMigration.V1.Model.EntityIssue.t)`, *default:* `nil`) - Details about the various issues found for the entity.
  *   `mappings` (*type:* `list(GoogleApi.DataMigration.V1.Model.EntityMapping.t)`, *default:* `nil`) - Details about entity mappings. For source tree entities, this holds the draft entities which were generated by the mapping rules. For draft tree entities, this holds the source entities which were converted to form the draft entity. Destination entities will have no mapping details.
  *   `materializedView` (*type:* `GoogleApi.DataMigration.V1.Model.MaterializedViewEntity.t`, *default:* `nil`) - Materialized view.
  *   `parentEntity` (*type:* `String.t`, *default:* `nil`) - The full name of the parent entity (e.g. schema name).
  *   `schema` (*type:* `GoogleApi.DataMigration.V1.Model.SchemaEntity.t`, *default:* `nil`) - Schema.
  *   `sequence` (*type:* `GoogleApi.DataMigration.V1.Model.SequenceEntity.t`, *default:* `nil`) - Sequence.
  *   `shortName` (*type:* `String.t`, *default:* `nil`) - The short name (e.g. table name) of the entity.
  *   `storedProcedure` (*type:* `GoogleApi.DataMigration.V1.Model.StoredProcedureEntity.t`, *default:* `nil`) - Stored procedure.
  *   `synonym` (*type:* `GoogleApi.DataMigration.V1.Model.SynonymEntity.t`, *default:* `nil`) - Synonym.
  *   `table` (*type:* `GoogleApi.DataMigration.V1.Model.TableEntity.t`, *default:* `nil`) - Table.
  *   `tree` (*type:* `String.t`, *default:* `nil`) - The type of tree the entity belongs to.
  *   `udt` (*type:* `GoogleApi.DataMigration.V1.Model.UDTEntity.t`, *default:* `nil`) - UDT.
  *   `view` (*type:* `GoogleApi.DataMigration.V1.Model.ViewEntity.t`, *default:* `nil`) - View.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :database => GoogleApi.DataMigration.V1.Model.DatabaseInstanceEntity.t() | nil,
          :databaseFunction => GoogleApi.DataMigration.V1.Model.FunctionEntity.t() | nil,
          :databasePackage => GoogleApi.DataMigration.V1.Model.PackageEntity.t() | nil,
          :entityDdl => list(GoogleApi.DataMigration.V1.Model.EntityDdl.t()) | nil,
          :entityType => String.t() | nil,
          :issues => list(GoogleApi.DataMigration.V1.Model.EntityIssue.t()) | nil,
          :mappings => list(GoogleApi.DataMigration.V1.Model.EntityMapping.t()) | nil,
          :materializedView => GoogleApi.DataMigration.V1.Model.MaterializedViewEntity.t() | nil,
          :parentEntity => String.t() | nil,
          :schema => GoogleApi.DataMigration.V1.Model.SchemaEntity.t() | nil,
          :sequence => GoogleApi.DataMigration.V1.Model.SequenceEntity.t() | nil,
          :shortName => String.t() | nil,
          :storedProcedure => GoogleApi.DataMigration.V1.Model.StoredProcedureEntity.t() | nil,
          :synonym => GoogleApi.DataMigration.V1.Model.SynonymEntity.t() | nil,
          :table => GoogleApi.DataMigration.V1.Model.TableEntity.t() | nil,
          :tree => String.t() | nil,
          :udt => GoogleApi.DataMigration.V1.Model.UDTEntity.t() | nil,
          :view => GoogleApi.DataMigration.V1.Model.ViewEntity.t() | nil
        }

  field(:database, as: GoogleApi.DataMigration.V1.Model.DatabaseInstanceEntity)
  field(:databaseFunction, as: GoogleApi.DataMigration.V1.Model.FunctionEntity)
  field(:databasePackage, as: GoogleApi.DataMigration.V1.Model.PackageEntity)
  field(:entityDdl, as: GoogleApi.DataMigration.V1.Model.EntityDdl, type: :list)
  field(:entityType)
  field(:issues, as: GoogleApi.DataMigration.V1.Model.EntityIssue, type: :list)
  field(:mappings, as: GoogleApi.DataMigration.V1.Model.EntityMapping, type: :list)
  field(:materializedView, as: GoogleApi.DataMigration.V1.Model.MaterializedViewEntity)
  field(:parentEntity)
  field(:schema, as: GoogleApi.DataMigration.V1.Model.SchemaEntity)
  field(:sequence, as: GoogleApi.DataMigration.V1.Model.SequenceEntity)
  field(:shortName)
  field(:storedProcedure, as: GoogleApi.DataMigration.V1.Model.StoredProcedureEntity)
  field(:synonym, as: GoogleApi.DataMigration.V1.Model.SynonymEntity)
  field(:table, as: GoogleApi.DataMigration.V1.Model.TableEntity)
  field(:tree)
  field(:udt, as: GoogleApi.DataMigration.V1.Model.UDTEntity)
  field(:view, as: GoogleApi.DataMigration.V1.Model.ViewEntity)
end

defimpl Poison.Decoder, for: GoogleApi.DataMigration.V1.Model.DatabaseEntity do
  def decode(value, options) do
    GoogleApi.DataMigration.V1.Model.DatabaseEntity.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.DataMigration.V1.Model.DatabaseEntity do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
